<template>
  <div>
		<v-header :headerLeftText="leftText" :headerCenterText="headerText"></v-header>
		
		<div class="container tixian_container bgd_color_gray">
			<div class="content_wrap box_size_border" style="margin-top: 10px">
				<div class="acount_row box_size_border">
					<span>申请提现的银行卡信息</span>
				</div>
				<div class="pad_lr26 f_size24 f_color_gray0 bgd_color_white border_bot2">
					<div class="pad_lr15 margin_t10 f_color_0 f_size24">
						<div class="">
							持卡人姓名：{{bankInfo.accountName}}
						</div>
						<div>
							开户银行：{{bankInfo.bankName}}
						</div>
						<div class="f_size24">
							开户网点：{{bankInfo.branchName}}
						</div>
						<div>
							银行卡号：{{bankInfo.bankCard}}
						</div>
					</div>
				</div>

				<div class="tixian_wrap">
					<div class="tx_jf_row">
						<div class="left tx_jf_col1">
							提现金额
						</div>
						<div class="left tx_jf_col2">
							<span>可提现金额</span>
							<span class="color_money f_color_main">{{remain}}</span>
						</div>
					</div>
					<div class="tx_input_row">
						<span>&yen;</span>
						<input v-model="money" type="number" name="" id="" value="" />
					</div>
					<div class="tx_note padding_tb30">
						注：提现实际到账金额自动扣除{{charge}}%的手续费。
					</div>
					<div class="button_row">
						<button @click="tixian" class="">申请提现</button>
					</div>
				</div>
			</div>
		</div>

  </div>
</template>
<script>
export default {
  created () {
    var self = this
    this.$api.get('/front/charge', null, r => {
      console.log('提现费率r', r)
      self.charge = r.data
    })
    this.$api.get('/front/banks', null, r => {
      console.log('银行卡信息r', r)
      self.bankInfo = r.data.list[0]
    })
    this.$api.get('/front/users', null, r => {
      console.log('users', r)
      console.log('r.list.length', r.data.list.length)
      if(r.data.list.length === 0) {
        self.remain = 0
      }else {
        self.remain = r.data.list[0].amount
      }
    })
  },
  data () {
    return {
    	leftText: '',
			headerText: '提现',
      bankInfo: {},
      accountName: '',
      bankName: '',
      branchName: '',
      bankCard: '',
      money: 0,
      charge: 0,
      rccountRecords: {},
      remain: 0
    }
  },
  methods: {
    tixian: function () {
      this.$api.post('/front/Cashes', {money: this.money}, r => {
        if(r.code === 400) {
          MessageBox('提示', '余额不足！')
        }else {
          MessageBox('提示', '提现成功！')
          self.$router.back(-1)
        }
      })
    }
  }
}
</script>

<style>
</style>
